package com.sh.common.enums;

/**
 * @author luotao
 */

public enum PublishedEnum {

    PUBLISHED(1, "是"),
    NOT_PUBLISHED(0, "否");

    private Integer code;
    private String message;

    PublishedEnum(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }

    public static String getMessageByCode(Integer code) {
        for (PublishedEnum usedEnum : PublishedEnum.values()) {
            if (usedEnum.code.equals(code)) {
                return usedEnum.getMessage();
            }
        }
        return null;
    }

    public static Boolean codeExisted(Integer code) {
        for (PublishedEnum usedEnum : PublishedEnum.values()) {
            if (usedEnum.code.equals(code)) {
                return true;
            }
        }
        return false;
    }

}
